05. Cascade PID Control
Cascade PID Control
Now that you have a better understanding of the quadrotor kinematics and dynamics, let us talk about how we can use the PID control technique we learned in previous lesson to control a quadrotor.
The altitude control example used in Lesson#1 is a SISO (Single Input, Single Output) system. In reality, most practical systems are MIMO (Multi-Input, Multi-Output). One way to handle MIMO systems is with a cascaded structure.
A general form of a cascaded controller looks like this:
Notice that there are two closed loop feedback controllers, with the primary controller wrapping around the secondary loop. This arrangement typically requires that the inner (secondary) loop execute much faster (>10x faster) than the outer (primary) loop. In other words, if the outer loop operates at 10 Hz the inner loop needs to operate at least 100 Hz. With this difference in update frequency, the primary setpoint of the outer loop will essentially look static to the inner loop.
In the context of the quadrotor, the primary controller is responsible for maintaining its 3D position and yaw angle while the inner loop controls attitude (i.e., the roll, pitch, and yaw angles). This control scheme would allow an operator to “let go” of the control inputs and have the quadrotor maintain a steady position and orientation in 3D space (assuming external disturbances are not too great!).
Without getting too deep into the mathematics involved, let’s let r represent the vector between the quadrotor’s current 3D location and its target position. The desired linear accelerations of the quadrotor’s center of mass can be found from PID feedback of this position error. By assuming that the roll and pitch angles stay near the equilibrium hover state, it is possible to linearize the equations of motion and express the desired roll and pitch angles as a function of the desired linear accelerations. The position controller passes the desired roll, pitch, yaw angles to the attitude controller. The attitude controller returns the changes in the nominal motor speeds that would move the quadrotor towards these desired roll and pitch angles.